﻿using System.Collections.Generic;

namespace Splendor_Server.script.logic.player
{
    public static class PlayerManager
    {
        //在线玩家列表
        private static Dictionary<string, Player> players = new Dictionary<string, Player>();

        //玩家是否在线
        public static bool IsOnline(string id)
        {
            return players.ContainsKey(id);
        }

        //获取玩家
        public static Player GetPlayer(string id)
        {
            return players.ContainsKey(id) ? players[id] : null;
        }

        //添加玩家
        public static void AddPlayer(string id, Player player)
        {
            players.Add(id, player);
        }

        //删除玩家
        public static void RemovePlayer(string id)
        {
            players.Remove(id);
        }
    }
}